package com.shiliao.app.weight.dialog;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.shiliao.app.R;
import com.yimei.framework.ui.dilaog.AnimationType;
import com.yimei.framework.ui.dilaog.YimeiBaseDialog;

import butterknife.OnClick;

/**
 * Created by yinzhiqiang on 2018/4/23.
 */

public class ExamineDialog extends YimeiBaseDialog {
    private ImageView close;
    private RadioButton examineId1;
    private RadioButton examineId2;
    private RadioButton examineId3;
    private RadioButton examineId4;
    private RadioButton examineId5;
    private  TextView commitChoice;
    private RadioGroup radioGroup;
    private int choiceId;
    public ExamineDialog(Activity mActivity) {
        super(mActivity);
        mContainerView = getLayoutInflater().inflate(R.layout.dialog_examine_content, null);
        close =  mContainerView.findViewById(R.id.iv_close);
        examineId1 =  mContainerView.findViewById(R.id.examine_id1);
        examineId2 =  mContainerView.findViewById(R.id.examine_id2);
        examineId3 =  mContainerView.findViewById(R.id.examine_id3);
        examineId4 =  mContainerView.findViewById(R.id.examine_id4);
        examineId5 =  mContainerView.findViewById(R.id.examine_id5);
        commitChoice =  mContainerView.findViewById(R.id.btn_commit_choice);
        radioGroup=mContainerView.findViewById(R.id.radio_group);
        mWindow.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER);
        mWindow.setWindowAnimations(mAnimations[AnimationType.TOAST_FADE
                .getValue()]);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    public int getRadio(){
                if(examineId1.isChecked()){
                    choiceId=1;
                }else if(examineId2.isChecked()){
                    choiceId=2;
                }else if(examineId3.isChecked()){
                    choiceId=3;
                }else if(examineId4.isChecked()){
                    choiceId=4;
                }else if(examineId5.isChecked()){
                    choiceId=5;
                }

        return choiceId;
    }

    public void commit(View.OnClickListener listener){
        commitChoice.setOnClickListener(listener);
    }

}
